package com.exchange.rate;

import java.util.ArrayList;
import java.util.List;
import android.app.ListActivity;
import android.os.Bundle;
import android.util.Log;

import android.widget.ArrayAdapter;


public class MessageList extends ListActivity {
	
	private List<Message> messages;
	String answer;
    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
       // setContentView(R.layout.main);
        loadFeed();
    }

	public String loadFeed(){
    	try{
	    	BaseFeedParser parser = new BaseFeedParser();
	    	messages = parser.parse();
	    	List<String> titles = new ArrayList<String>(messages.size());
	    	
	    	
	    	
	    	for (Message msg : messages){
	    		
	    	    CharSequence CAD = "CAD";
				if(msg.getTitle().contains(CAD)){
			    answer = msg.getTitle();
	    		titles.add(msg.getTitle());
				}
	    	}
	    	
	    	
	    	
//	    	ArrayAdapter<String> adapter = 
//	    		new ArrayAdapter<String>(this, R.layout.row,titles);
//	    	this.setListAdapter(adapter);
	    	
    	} catch (Throwable t){
    		Log.e("AndroidNews",t.getMessage(),t);
    	}
    	return answer;
    }
    
}